---
title: "Educational Data Science Capstone Project"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
source_code: embed
vertical_layout: scroll
theme: united
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(here)
library(janitor)
library(rio)
library(colorblindr)
library(gghighlight)
library(forcats)
library(ggrepel)
library(gt)
library(knitr)
library(kableExtra)
library(reactable)
library(plotly)
library(glue)
library(fs)
library(rstatix)
library(ggpubr)
library(writexl)
library(remotes)
theme_set(theme_minimal(15) +
theme(legend.position = "bottom",
panel.grid.major.x = element_line(color = "gray60"),
panel.grid.minor.x = element_blank(),
panel.grid.major.y = element_blank())
)
```
```{r, include=FALSE}
# all impact data
impact_all <- read_csv(here("data", "impact_data.csv"))
str(impact_all)
#all clean sims data
sims_concussion_data <- read_csv(here("data", "sims_concussion_data.csv"))
str(sims_concussion_data)
#impact data only
one_impact_test <- read_csv(here("data", "one_post_injury_impact_test.csv"))
str(one_impact_test)
two_impact_test <- read_csv(here("data", "two_post_injury_impact_test.csv"))
three_impact_test <- read_csv(here("data", "three_post_injury_impact_test.csv"))
four_impact_test <- read_csv(here("data", "four_post_injury_impact_test.csv"))
# impact sims merge data
one_impact_sims <- read_csv(here("data", "one_post_injury_test_impact_sims_merge.csv"))
str(one_impact_sims)
two_impact_sims <- read_csv(here("data", "two_post_injury_test_impact_sims_merge.csv"))
three_impact_sims <- read_csv(here("data", "three_post_injury_test_impact_sims_merge.csv"))
four_impact_sims <- read_csv(here("data", "four_post_injury_test_impact_sims_merge.csv"))
# pcss items
pcss_items <- import(here("data", "pcss_items.xlsx"),
setclass = "tbl_df")
```
```{r, include=FALSE}
#helpful functions
mean_2 <- function(x) {
z <- na.omit(x)
sum(z) / length(z)
}
my_mean <- function(x) {
mean(x[x >= 0], na.rm = TRUE)
}
create_react_time <- function(df, var) {
df %>%
summarize(Mean = mean({{var}}),
SD = sd({{var}}),
Min = min({{var}}),
Max = max({{var}}),
Total = length({{var}})) %>%
mutate_if(is.numeric, round, 2) %>%
reactable(columns = list(
Mean = colDef(format = colFormat(separators = TRUE, suffix = " days")),
SD = colDef(format = colFormat(separators = TRUE, suffix = " days")),
Min = colDef(format = colFormat(separators = TRUE, suffix = " days")),
Max = colDef(format = colFormat(separators = TRUE, suffix = " days")),
Total = colDef(format = colFormat(separators = TRUE, suffix = " concussions"))
))
}
create_react <- function(df, var) {
df %>%
summarize(Mean = mean({{var}}),
SD = sd({{var}}),
Min = min({{var}}),
Max = max({{var}}),
Total = length({{var}})) %>%
mutate_if(is.numeric, round, 2) %>%
reactable(columns = list(
Mean = colDef(format = colFormat(separators = TRUE)),
SD = colDef(format = colFormat(separators = TRUE)),
Min = colDef(format = colFormat(separators = TRUE)),
Max = colDef(format = colFormat(separators = TRUE)),
Total = colDef(format = colFormat(separators = TRUE, suffix = " concussions"))
))
}
```
# Data Overview
*_Data Description_* {.sidebar}
------------
The data for this capstone project was provided by the Hawaii Concussion Awareness and Management Program [(HCAMP)](https://hawaiiconcussion.com/), which is an organization affiliated with the University of Hawaii. The mission of HCAMP is to develop evidence-based interventions to manage concussion.
The specific goal of this project is to explore trends from two data sets. The first data set contains multiple years of test and symptom severity scores from the Immediate Post-Concussion Assessment and Cognitive Testing [(ImPACT)](https://impactconcussion.com/) software. The second data set contains multiple years of return-to-learn (RTL) and return-to-play (RTP) outcome data from the Hawaii Department of Education Student Information Management System (SIMS). The ImPACT data set is utilized to explore trends in symptom severity, as measured by the [Post-Concussion Symptom Scale (PCSS)](tools/Post-Concussion-Symptom-Scale1.pdf), across individuals who completed post-injury testing following their concussion. The ImPACT data set is divided into four smaller data sets to represent individuals who completed one post-injury test, two post-injury tests, three post-injury tests, and four post-injury tests. Specific to this data set, the following research question is explored: Is there a significant difference between PCSS cluster symptom scores during the recovery process? The six symptom clusters used for this project are adapted from Lumba-Brown et al. (2019) and Harmon et al. (2019).
The SIMS data set is utilized to explore trends in the duration of time to complete RTL and RTP protocols. The ImPACT and SIMS data sets have been joined corresponding to the number of post-injury tests completed from the ImPACT data set. Although the merger of these data sets did not yield a large number of observations to analyze, the following research question is explored: What is the relationship between symptom severity scores and RTL/RTP duration?
Row
-----------------------------------------------------------------------
### ImPACT Test Totals
```{r, include=FALSE}
t_sum_pi <- data.frame("Level" = c("One Post-Injury Test",
"Two Post-Injury Tests",
"Three Post-Injury Tests",
"Four Post-Injury Tests"),
"Total" = c(9991,
5295,
2228,
780))
```
```{r, include=FALSE}
t_sum_pi %>%
reactable(columns = list(
Level = colDef(name = "Level",
align = "center"),
Total = colDef(name = "Total",
align = "center",
format = colFormat(separators = TRUE, suffix = " individuals"))),
striped = TRUE,
outlined = TRUE,
compact = TRUE,
highlight = TRUE,
bordered = TRUE)
```
```{r, include=FALSE}
pi_plot <- ggplot(t_sum_pi, aes(fct_reorder(Level, Total), Total)) +
geom_col(fill = "blue",
alpha = 0.7) +
scale_y_continuous(labels = function(x) format(x, big.mark = ",",
scientific = FALSE)) +
coord_flip() +
theme(axis.text.x = element_text(angle = 45)) +
labs(x = "",
y = "Individuals")
```
```{r, include=TRUE}
ggplotly(pi_plot)
```
### PCSS Description
```{r}
pcss_items %>%
reactable(columns = list(
Item = colDef(name = "Item",
align = "center"),
Symptom = colDef(name = "Symptom",
align = "center"),
Cluster = colDef(name = "Cluster",
align = "center")),
striped = TRUE,
outlined = TRUE,
compact = TRUE,
highlight = TRUE,
bordered = TRUE,
searchable = TRUE)
```
Row
-----------------------------------------------------------------------
### PCSS Description
```{r}
```
### PCSS Description
```{r}
```